$(document).ready(function(){
	$('.dataTables_length').css("display", "none");
	$(".save_txt").click(function(){
	var ID=$(this).attr('id');
	var description =  $("#des_input_"+ID).val();
	var newImg = $("#newImg_"+ID).val();
	var img = $("#curImg_"+ID).attr('src').substring(baseurl.length)
	if (newImg) {
		img = newImg;
	}
	if (description != "") {
			$.ajax({
			url: baseurl + "admin_services/edit",
			type: "post",
			data:{'img':img,'description':description,'ID':ID},
			success: function(str){
				var string = $.parseJSON(str);
					if (string.success == false) {
						alert(string.reason);
					}else{
						$("#des_"+ID).text(description);
						$("#curImg_"+ID).attr("src", baseurl + img);
						$("#PhotoPrevs_"+ID).empty();
						$("#"+ID+" .edit_txt").toggle();
						$("#"+ID+" .save_txt").toggle();
						$("#"+ID+" .cancel_txt").toggle();
						$("#"+ID+" .value").toggle();
						$("#"+ID+" .input").toggle();
					}
			},
				error: function(str){alert('Error!! Please contact the administrator.');}
			});
			}else{
				alert('Please enter description');
			}
	});
});


 
